package movenment2copy;


/**
 * This class saves a name and score, uses comparable to compare
 * scores with other pairs , it the scores are equal the new will
 * be ranked lower.
 * @author Alexander
 *
 */
public class Pair implements Comparable<Pair>{
	
	/**
	 * int score represents the score of the pair.
	 */
	private int score;
	private String name;
	
	/**
	 * The constructor creates a pair with given age and name.
	 */
	public Pair(String name ,int score){
		this.score = score;
		this.name = name;
	}
	/**
	 * Gets the score of Pair
	 * @return score of this Pair
	 */
	public int getScore(){
		return score;
	}
	/**
	 * Gets the name of Pair
	 * @return name of this Pair
	 */
	public String getName(){
		return name;
	}
	
	
	@Override
	/**
	 * This method overrides the compareTo method in Comparable<T>.
	 * I define the natural order here.
	 * @return negative integer or a positive integer whether
	 * this object is less than and equal to or greater than the 
	 * specified object. 
	 */
	public int compareTo(Pair other) {
		int otherScore = other.getScore();
		if((score - otherScore) == 0){
			return 1;
		}
		return  otherScore - score;
	}

}
